{% extends 'base.html' %}
{% block content %}
    {% for article in article_list %}
        <article>
            <h3>{{ article.title }}</h3>
            <div>
      <span>{{ article.author }} {{ article.created_time }}
        <a href="#">阅读{{ article.views }}</a>
        <a href="#">评论{{ article.comment_set.count }}</a>
      </span>
            </div>
            <p>
                {{ article.excerpt }}
            </p>
            <div>
                <a href="{% url 'myblog:detail' article.pk %}" class="more-link">继续阅读</a>
            </div>
            <hr>
        </article>
    {% empty %}
        暂时还没有文章！
    {% endfor %}
    {% if page_obj.has_other_pages %}
        <nav class="margin-tb-1 text-center">
            {% if page_obj.has_previous %}
                <a href="?page={{ page_obj.previous_page_number }}{% if request.GET.q %}&q={{ request.GET.q }}{% endif %}">上一页</a>
            {% endif %}
            <strong> {{ page_obj.number }} </strong>
            {% if page_obj.has_next %}
                <a href="?page={{page_obj.next_page_number }}&{% if request.GET.q %}&q={{ request.GET.q }}{% endif %}">下一页</a>
            {% endif %}
        </nav>
    {% endif %}
{% endblock %}